package com.zxc.factory;

import com.zxc.pricing.PriceCalculator;
import com.zxc.pricing.BasicPriceCalculator;
import com.zxc.pricing.decorator.FullReductionDecorator;
import com.zxc.pricing.decorator.StrawberryDiscountDecorator;

// CalculatorFactory.java
public class CalculatorFactory {

    // 问题1：只有苹果和草莓的基础计算
    public static PriceCalculator createCalculatorForCustomerA() {
        return new BasicPriceCalculator();
    }

    // 问题2：增加芒果的基础计算
    public static PriceCalculator createCalculatorForCustomerB() {
        return new BasicPriceCalculator();
    }

    // 问题3：草莓8折优惠
    public static PriceCalculator createCalculatorForCustomerC() {
        PriceCalculator basicCalculator = new BasicPriceCalculator();
        return new StrawberryDiscountDecorator(basicCalculator, 0.8);
    }

    // 问题4：草莓8折 + 满100减10
    public static PriceCalculator createCalculatorForCustomerD() {
        PriceCalculator basicCalculator = new BasicPriceCalculator();
        PriceCalculator discountCalculator = new StrawberryDiscountDecorator(basicCalculator, 0.8);
        return new FullReductionDecorator(discountCalculator, 100, 10);
    }
}
